Skip to content

Implementation of custom bytetrack demo for real time stream analysis [GSoC'2026] - #4420

Open
Vishwa2684 wants to merge 25 commits into
openvinotoolkit:mainfrom
Vishwa2684:gsoc_bytetrack
Open

Implementation of custom bytetrack demo for real time stream analysis [GSoC'2026]#4420
Vishwa2684 wants to merge 25 commits into
openvinotoolkit:mainfrom
Vishwa2684:gsoc_bytetrack

Conversation

@Vishwa2684

@Vishwa2684 Vishwa2684 commented Jul 30, 2026

Copy link
Copy Markdown

@atobiszei @dtrawins

Summary

This PR adds a ByteTrack Real-Time Stream Analysis demo for OpenVINO Model Server (OVMS).

The demo reuses the MediaPipe ByteTrack graph from demos/mediapipe/bytetrack with the yolox_tiny model and integrates it with the real_time_stream_analysis Python client. This enables object detection and multi-object tracking on RTSP streams using OVMS.

Key Changes

Directory Structure

Directory Description
demos/mediapipe/bytetrack MediaPipe ByteTrack OVMS demo and configuration
src/bytetrack ByteTrack utilities and ByteTrack calculator
src/yolox Utilities for processing YOLOX-Tiny output tensors and converting them into detections

What's Included

  • A new MediaPipe ByteTrack demo in demos/mediapipe/bytetrack.
  • Setup instructions covering model conversion, OVMS deployment, and RTSP streaming.
  • A client.py example for running inference with:
    • Video input and output.
    • RTSP input and output streams.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new MediaPipe ByteTrack demo that integrates OVMS + the existing real-time stream analysis Python client to run object detection + multi-object tracking on RTSP streams. It also updates the MediaPipe build integration and adjusts streaming timestamp handling in the KFS graph executor.

Changes:

  • Adds a new demos/mediapipe/bytetrack demo (graph, OVMS config, and setup README).
  • Extends the real-time stream analysis Python demo CLI to pass FFmpeg output dimensions through to StreamClient.
  • Updates MediaPipe/Bazel integration (new ByteTrack calculators dependency; changes MediaPipe git_repository source) and adds stricter timestamp monotonicity checks for streaming.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
WORKSPACE Switches the MediaPipe repository source (currently to a fork/branch).
third_party/mediapipe_calculators/BUILD Adds ByteTrack calculators target to the OVMS MediaPipe calculators aggregation library.
src/kfs_frontend/kfs_graph_executor_impl.cpp Changes timestamp deserialization/defaulting and adds stream-level monotonic timestamp enforcement.
demos/real_time_stream_analysis/python/client.py Adds CLI args for FFmpeg output width/height and forwards them to StreamClient.
demos/mediapipe/bytetrack/README.md Introduces demo setup/run instructions for ByteTrack RTSP streaming demo.
demos/mediapipe/bytetrack/config.json Adds OVMS config for the YOLOX model + ByteTrack MediaPipe graph.
demos/mediapipe/bytetrack/bytetrack_ovms.pbtxt Adds the MediaPipe graph wiring OpenVINO/OVMS inference + ByteTrack tracking + overlay.
Suppressed comments (1)

src/kfs_frontend/kfs_graph_executor_impl.cpp:1147

  • The inline comment "// this method" is not descriptive. Either remove it or replace with a comment that explains what the function does.
// this method
Status createAndPushPacketsImpl(

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread third_party/mediapipe_calculators/BUILD Outdated
Comment thread demos/mediapipe/bytetrack/bytetrack_ovms.pbtxt Outdated
Comment thread WORKSPACE
Comment thread src/kfs_frontend/kfs_graph_executor_impl.cpp Outdated
Comment thread src/kfs_frontend/kfs_graph_executor_impl.cpp Outdated
Comment thread src/kfs_frontend/kfs_graph_executor_impl.cpp Outdated
Comment thread demos/real_time_stream_analysis/python/client.py Outdated
Comment thread demos/mediapipe/bytetrack/README.md Outdated
Comment thread demos/mediapipe/bytetrack/README.md Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@dtrawins

Copy link
Copy Markdown
Collaborator

make sdl-check is failing with error:
No header files detected:
./demos/mediapipe/bytetrack/bytetrack_ovms.pbtxt
Could you add it to exception list in ci/lib_search.py

@Vishwa2684

Vishwa2684 commented Aug 12, 2026

Copy link
Copy Markdown
Author

@atobiszei @dtrawins I've written code for custom calculator OVYoloXTensorsToDetections in src/yolox, and wrote a script to download OpenVINO/yolox_tiny-fp16-ov model weights and write class labels from the model config.

@Vishwa2684
Vishwa2684 requested a review from dtrawins August 12, 2026 11:28
@Vishwa2684
Vishwa2684 force-pushed the gsoc_bytetrack branch 2 times, most recently from 4a0b8f8 to bf1c022 Compare August 13, 2026 18:13
@Vishwa2684

Copy link
Copy Markdown
Author

@dtrawins Why is the ci failing? Could you share the logs?

@Vishwa2684
Vishwa2684 force-pushed the gsoc_bytetrack branch 7 times, most recently from 7d36dd6 to 2b2ba29 Compare August 19, 2026 22:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 28 out of 29 changed files in this pull request and generated 16 comments.

Comment thread src/bytetrack/calculators/matching_utils.h
Comment thread src/bytetrack/calculators/bytetrack_calculator.cc Outdated
Comment thread src/bytetrack/calculators/bytetrack_calculator.cc Outdated
Comment thread src/bytetrack/calculators/basetrack.h Outdated
Comment thread src/bytetrack/calculators/bytetrack_calculator.cc Outdated
return absl::OkStatus();
}

absl::Status Process(CalculatorContext* cc) final {
Comment thread src/bytetrack/calculators/BUILD
Comment thread src/bytetrack/utils/detection_color_by_id_calculator.cc
Comment thread src/bytetrack/calculators/strack.h Outdated
Comment thread demos/mediapipe/bytetrack/README.md Outdated
Comment thread demos/mediapipe/bytetrack/bytetrack_ovms.pbtxt Outdated
Comment thread src/bytetrack/calculators/basetrack.h Outdated
Comment thread src/bytetrack/calculators/BUILD Outdated
Comment thread src/bytetrack/calculators/BUILD Outdated
Comment thread src/bytetrack/calculators/bytetrack_calculator.h Outdated
Comment thread src/bytetrack/calculators/kalman_matrices.h Outdated
Comment thread src/bytetrack/calculators/matching_utils.h Outdated
Comment thread src/bytetrack/calculators/strack.h Outdated
Comment thread src/bytetrack/utils/BUILD Outdated
Comment thread src/yolox/BUILD Outdated
@Vishwa2684
Vishwa2684 requested a review from atobiszei August 31, 2026 17:00
float score_ = 0.f;
bool is_activated_ = false;
TrackState state_ = TrackState::NEW;
static std::atomic<int> count_;

@atobiszei atobiszei Sep 2, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is static - one instance per OVMS instance. OVMS allows for several concurrent inferences at a time - don't we have a bug here? We should have a bytetrack stored per graph/calculator instance not per process.

Comment thread src/bytetrack/calculators/strack.cc Outdated
Comment thread src/bytetrack/calculators/bytetrack_calculator.cc Outdated
Comment thread src/bytetrack/calculators/BUILD Outdated
Comment thread src/bytetrack/calculators/bytetrack_calculator.cc Outdated
Comment thread src/bytetrack/calculators/bytetrack_calculator.cc Outdated
Comment thread src/bytetrack/calculators/bytetrack_calculator.cc Outdated

namespace mediapipe {

class DetectionColorByIdCalculator : public CalculatorBase {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coudl we add some simple test for this calculator using mediapipe::CalculatorRunner and for ov_yolox_tensors_to_detections?

Comment thread src/bytetrack/calculators/matching_utils.h Outdated
};

// IoU between two [top, left, bottom, right] boxes
inline float ComputeIoU(const Eigen::Vector4f& a,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a lot of utilities functions in PR that could end in exceptions. We should defend against such cases at some point, as hackers could try to do DoS on OVMS with malicious inputs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants